package com.threea.controller;

import com.threea.common.result.Result;
import com.threea.common.result.ResultUtil;
import com.threea.pojo.Furniture;
import com.threea.service.FurnitureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/threea")
public class FurnitureController {

    @Autowired
    private FurnitureService furnitureService;

    // 获取所有家具
    @RequestMapping("/getFurnitureAll")
    public Result getFurnitureAll(){
        System.out.println("getFurnitureAll");
        List<Furniture> list = furnitureService.getFurnitureAll();
        return ResultUtil.success(list);
    }

    // 删除家具
    @DeleteMapping("/deleteFurniture")
    public Result deleteFurniture(@RequestParam("id")  int id){
        System.out.println("deleteFurniture");
        return ResultUtil.success("success");
    }

    /**
     * 新增家具
     */
    @PostMapping("/addFurniture")
    public Result addFurniture(@RequestBody Furniture furniture){
        System.out.println("addFurniture");
        // furnitureService.addFurniture(furniture);
        return ResultUtil.success("success");
    }
}
